#!/usr/bin/env bash
now_dir=`pwd`
cd `dirname $0`

shell_dir=`pwd`

cd ${shell_dir}

rm -rf echo-dist
mkdir echo-dist


# echo client
cd ${shell_dir}
./echo-client/generate-bin.sh
echo_client_version=`cat ./echo-client/target/echo_client_version.txt`
cp ./echo-client/target/echo-client-${echo_client_version}.zip echo-dist/

# echo http proxy server
cd ${shell_dir}
./echo-http-proxy-server/generate-bin.sh
echo_http_proxy_version=`cat ./echo-http-proxy-server/target/echo_http_proxy_version.txt`
cp ./echo-http-proxy-server/target/echo-http-proxy-${echo_http_proxy_version}.zip echo-dist/

#echo nat server
cd ${shell_dir}
./echo-nat-server/generate-bin.sh
echo_nat_version=`cat ./echo-nat-server/target/echo_nat_version.txt`
cp ./echo-nat-server/target/dist-echo-nat-${echo_nat_version}.zip echo-dist/

# build information
cd ${shell_dir}
touch echo-dist/echo_release.txt
now_data=`date`
echo "# auto generated by echo system" > echo-dist/echo_release.txt
echo "# @author virjar " >> echo-dist/echo_release.txt
echo "# date ${now_data}" >> echo-dist/echo_release.txt
echo "echo_client_version=${echo_client_version}" >> echo-dist/echo_release.txt
echo "echo_http_proxy_version=${echo_http_proxy_version}" >> echo-dist/echo_release.txt
echo "echo_nat_version=${echo_nat_version}" >> echo-dist/echo_release.txt

cd echo-dist/
zip -r echo-release.zip ./*
mv echo-release.zip ../
cd ${shell_dir}
rm -rf echo-dist/





